<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<div th:replace="common/common::html"></div>
<div th:replace="file/resouceAcl::html"></div>
<head>
    <meta charset="UTF-8">
    <title th:text="#{file.page.title}">Title</title>
    <style>
        .search-tools-ul
        {
            left:5px;
        }
    </style>

    <script th:inline="javascript">
        var _gridWidth = null;
        var _gridHeight = null;
        //页面自适应
        function resizePageSize(){
            _gridWidth = $(window).width()-12;/*  -189 是去掉左侧 菜单的宽度，   -12 是防止浏览器缩小页面 出现滚动条 恢复页面时  折行的问题 */
            _gridHeight = $(window).height()-32-75; /* -32 顶部主菜单高度，   -140 查询条件高度*/
        }
        $(function () {

            window.addEventListener("resize",function () {
                resizePageSize();
                $("#flexgrid-id").flexResize(_gridWidth,_gridHeight)
            })
            resizePageSize();
            var _columnWidth = (_gridWidth - 150)/3;
            $("#synch-btn-id").click(function () {//文件同步按钮
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{synchFileData}]]*/'',
                    data: [

                    ],
                    success: function (data) {
                        message(data.msg);
                        query();

                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });
            });
            $("#copy-btn-id").click(function () {//文件复制按钮
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{copyFileData}]]*/'',
                    data: [

                    ],
                    success: function (data) {
                        message(data.msg);

                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });

            });

            //文件删除按钮
            $("#delete-btn-id").click(function () {
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{deleteFileData}]]*/'',
                    data: [
                    ],
                    success: function (data) {
                        message(data.msg);
                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });

            });
            $("#forward-btn-id").click(function () {//前进按钮
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{forwordFileData}]]*/'',
                    data: [

                    ],
                    success: function (data) {
                        message(data.msg);

                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });
            });

            $("#return-btn-id").click(function () {//返回按钮
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{returnFileData}]]*/'',
                    data: [

                    ],
                    success: function (data) {
                        message(data.msg);

                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });
            });
            //搜索框
            $("#nav-tools-article-id").searchTools({
                colModel : [
                    {display : /*[[#{file.name}]]*/"", domId:"search-file-name"},

                ],
                reback:function () {
                    query();
                }
            });


            $("#flexgrid-id").flexigrid({
                width : _gridWidth,
                height : _gridHeight,
                url : /*[[@{queryFileListByPage}]]*/"",
                dataType : 'json',
                colModel : [
                    {display : 'fileUuid',name : 'fileUuid',width : 150,sortable : false,align : 'center',hide : 'true'},
                    {display : /*[[#{file.name}]]*/"",name : 'fileName',width : _columnWidth, sortable : true,align : 'left',
                        process: function(v,_trid,_row) {
                            var contents = "";
                            // console.info((_row));
                            if (_row.fileType === 1) {
                                contents += '<a class="btn forder" onclick="enterDir(\'' + _row.filePath + '\',\'' + _row.fileUuid + '\')">' + '<i class="glyphicon glyphicon-folder-close"></i>' + v + '</a>';

                            } else {

                                    contents += '<a class="btn" onclick="preFile(\'' + v + '\',\'' + _row.fileUuid + '\')">' + '<i class="glyphicon glyphicon-file"></i>' + v + '</a>';

                            }
                            return contents;

                        }
                    },

                    {
                        display:  /*[[#{file.capacity}]]*/"",
                        name: 'fileCapacity',
                        width: _columnWidth,
                        sortable: true,
                        align: 'center',
                        process: function(v,_trid,_row){
                            var contents = "";
                            if ( _row.fileType === 1){
                                contents="--";
                            }else {
                                if (v>(1024*1024*1024)){
                                    var val =v/(1024*1024*1024);
                                    contents +='<span>' + val.toFixed(1) +'</span><span>GB</span>'
                                }else if (v>(1024*1024)) {
                                        var val = v/(1024 * 1024 );
                                        contents += '<span>' + val.toFixed(1) + '</span><span>MB</span>'
                                }else if (v>(1024)) {
                                    var val = v/1024;
                                    contents += '<span>' + val.toFixed(1) + '</span><span>KB</span>'
                                }else {
                                    contents += '<span>' + v + '</span><span>B</span>'
                                }
                            }
                            return contents;
                        }
                    },
                    {
                        display:  /*[[#{common.operation}]]*/"",
                        name: 'fileUuid',
                        width: _columnWidth,
                        sortable: true,
                        align: 'center',
                        process: function(v,_trid,_row) {
                            var contents = "";
                            if ( _row.fileType === 1) {
                                contents = '--';
                            }
                            else {
                                //文件下载
                                contents += '<a class="btn" title=[[#{file.download.btn}]] href="downloadFile/' + v + '" target="_blank"> <i class="glyphicon glyphicon-arrow-down"></i> </a>';
                                //文件分享
                                contents += '<a class="btn" title=[[#{file.share}]]  ' +
                                    'onclick="shareFile(\'' + v + '\',\'' + _row.fileName + '\')"'
                                    + '> <i class="glyphicon glyphicon-share"></i> </a>';
                                //文件删除
                                contents += '<a class="btn" title=[[#{file.delete}]] ' +
                                    'onclick="deleteFile(\'' + v + '\' , \'' + _row.fileName + '\',\'' + _row.fileUuid + '\')"'
                                    + '> <i class="glyphicon glyphicon-trash"></i> </a>';
                                //资源访问权限
                                contents += '<a class="btn" title=[[#{file.resouce.acl}]] ' +
                                    'onclick="resouceAcl(\'' + v + '\')"'
                                    + '> <i class="glyphicon glyphicon-hdd"></i> </a>';
                            }
                            return contents;
                        }},
                ],
                resizable: false, //resizable table是否可伸缩
                useRp: true,
                usepager: true, //是否分页
                autoload: false, //自动加载，即第一次发起ajax请求
                hideOnSubmit: true, //是否在回调时显示遮盖
                showcheckbox: true, //是否显示多选框
                rowhandler : rowDbclick, //是否启用行的扩展事情功能,在生成行时绑定事件，如双击，右键等
                rowbinddata: true

            });
            query();
            //查询按钮
            $("#query-btn-id").click(function () {
                query();
            });
            //删除文件按钮

            $("#delete-file-btn-id").click(function () {
                $("#file-delete-form-id").resetForm();
                var filePath = $("#dir-input-id").val();
                $("#up-file-path-").val(filePath);
                $("#file-delete-dialog").dialog('open');
            });
            //复制文件对话框
            $("#copy-file-dialog-id").dialog({
                autoOpen: false,
                width: 400,
                modal: true,
                resizable: false,
                title: /*[[#{file.copy.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function () {
                            $("copy-file-dialog-id").dialog('close');
                            var pId=null;
                            var ztreeObj = $.fn.zTree.getZTreeObj("copy-file-ztree-id");
                            var nodes = ztreeObj.getCheckedNodes(true);
                            $(nodes).each(function (index, item) {
                                pId=item.id;
                            })
                            var fileUuid =$("#copy-file-dialog-id").attr("fileUuid");
                            $.ajax({
                                type: 'post',
                                async: false,
                                dataType: 'json',
                                url: /*[[@{saveFileRefCopy}]]*/'',
                                data: [
                                    {name: "fileUuid", value: fileUuid},
                                    {name: "pId", value: pId}
                                ],
                                success: function (data) {
                                    message(data.msg);
                                    $("#copy-file-dialog-id").dialog('close');
                                },
                                error: function (msg) {
                                    message(/*[[#{common.error}]]*/'');
                                }
                            });

                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function () {
                            $(this).dialog("close");
                        }
                    }
                ]
            });
            //复制文件按钮
            $("#copy-btn-id").click(function () {
                 //$("#copy-file-dialog-id").dialog('open');
                copyFileBatch();
            });
            var allocateSetting = {
                check: {
                    chkStyle: "radio",
                    radioType: "level",
                    chkStyle: "radio",
                    radioType: "all",
                    enable: true
                },
                data: {
                    simpleData: {
                        enable: true
                    }
                }
            };


            //批量复制文件
            function copyFileBatch() {
                var ids = $("#flexgrid-id").getFlexigridiAttrByIndex(0);
                if(ids.length === 0){
                    message(/*[[#{common.select.one}]]*/);
                    return;
                }
                $("#copy-file-dialog-id").attr("fileUuid",ids);
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType : 'json',
                    url: /*[[@{/file/queryFileZtreeAll}]]*/'',
                    data: [],
                    success: function (data) {
                        $.fn.zTree.init($("#copy-file-ztree-id"), allocateSetting, data);
                        $("#copy-file-dialog-id").dialog('open');
                    },
                    error: function(msg){
                        message(/*[[#{common.error}]]*/'');
                    }
                });
            }

            //上一级目录按钮
            $("#up-dir-btn-id").click(function(){
                var fileUuid = $("#dir-input-id").attr("fileUuid");
                $.ajax({
                    type: 'post',
                    async: false,
                    dataType: 'json',
                    url: /*[[@{queryFileInfoById}]]*/'',
                    data: [
                        {name:"fileUuid",value:fileUuid}
                    ],
                    success: function (data) {
                        console.info(data);
                        if (data) {
                            enterDir(data.filePath, data.fileUuid);
                        }else{
                            enterDir("/","-1");
                        }
                    },
                    error: function (msg) {
                        message(/*[[#{common.error}]]*/'');
                    }
                });
            });

            //上传文件按钮
            $("#upload-file-btn-id").click(function () {
                $("#file-upload-form-id").resetForm();
                var filePath = $("#dir-input-id").val();
                $("#up-file-path-").val(filePath);
                $("#file-upload-dialog").dialog('open');
            });

            //复制链接
            $("copy-link-btn-id").click(function () {
                $("#share-link-id").focus();
                $("#share-link-id").select();
                document.execCommand("Copy");
            })
            //初始化分享对话框
            $("#share-file-dialog-id").dialog({
                autoOpen : false,
                width : 600,
                modal : true,
                resizable : false,
                title: /*[[#{file.share.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });


            //上传文件按钮
            $("#upload-file-btn-id").click(function () {
                var filePath = $("#dir-input-id").val();
                $("#up-file-path-id").val(filePath);
                $("#file-upload-dialog").dialog('open');
            });
            //初始化上传文件表单
            $("#file-upload-form-id").ajaxForm({
                dataType: "json",
                success : function (data) {
                    message(data.msg);
                    query();
                    $("#file-upload-dialog").dialog('close');
                },
                error : function () {
                    message(/*[[#{common.error}]]*/'');
                },
                complete : function (response,status) {

                }
            })
            //初始化上传文件对话框
            $("#file-upload-dialog").dialog({
                autoOpen : false,
                width : 600,
                modal : true,
                resizable : false,
                title: /*[[#{file.upload.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            if (!$("#file-upload-file-id").checkDom()){
                                return
                            }
                            $("#file-upload-form-id").submit();
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });
            //初始化移动对话框
            $("#file-move-dialog").dialog({
                autoOpen : false,
                width : 600,
                modal : true,
                resizable : false,
                title: /*[[#{file.move.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function () {
                            $("file-move-dialog-id").dialog('close');
                            var pId=null;
                            var ztreeObj = $.fn.zTree.getZTreeObj("file-move-ztree-id");
                            var nodes = ztreeObj.getCheckedNodes(true);
                            $(nodes).each(function (index, item) {
                                pId=item.id;
                            })
                            var fileUuid =$("#file-move-dialog-id").attr("fileUuid");
                            $.ajax({
                                type: 'post',
                                async: false,
                                dataType: 'json',
                                url: /*[[@{moveFileByBatch}]]*/'',
                                data: [
                                    {name: "fileUuid", value: fileUuid},
                                    {name: "pId", value: pId}
                                ],
                                success: function (data) {
                                    message(data.msg);
                                    $("#file-move-dialog-id").dialog('close');
                                },
                                error: function (msg) {
                                    message(/*[[#{common.error}]]*/'');
                                }
                            });

                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });
            //移动文件按钮
            $("#file-move-btn-id").click(function () {
               fileMoveBatch();
            });
            //初始化删除对话框
            $("#recycle-file-dialog-id").dialog({
                autoOpen : false,
                width : 600,
                modal : true,
                resizable : false,
                title: /*[[#{file.delete.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            var fileUuid = $("#recycle-file-dialog-id").attr("fileUuid");
                            $.ajax({
                                type:'post',
                                async:false,
                                dataType:'json',
                                url: /*[[@{deleteFile}]]*/'',
                                data:[
                                    {name:"fileUuid",value:fileUuid}
                                ],
                                success:function (data) {
                                    message(data.msg);
                                    $("#recycle-file-dialog-id").dialog('close')
                                    query();
                                },
                                error: function (msg){
                                    message(/*[[#{common.error}]]*/'');
                                }
                            });
                            $( this ).dialog( "close" );
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });

            //初始化修改文件对话框
            $("#modify-file-name-id").dialog({
                autoOpen : false,
                width : 600,
                modal : true,
                resizable : false,
                title: /*[[#{file.modify.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            var fileName =  $("#mo-file-name-id").val();
                            var fileUuid = $("#modify-file-name-id").attr("fileUuid");
                            $.ajax({
                                type:'post',
                                async:false,
                                dataType:'json',
                                url: /*[[@{modifyFile}]]*/'',
                                data:[
                                    {name:"fileName",value:fileName},
                                    {name:"fileUuid",value:fileUuid},
                                ],
                                success:function (data) {
                                    message(data.msg);
                                    $("#modify-file-name-id").dialog('close')
                                    query();
                                },
                                error: function (msg){
                                    message(/*[[#{common.error}]]*/'');
                                }
                            });
                            $( this ).dialog( "close" );
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });

            //复制链接
            $("#copy-link-btn-id").click(function () {
                $("#share-link-id").focus();
                $("#share-link-id").select();
                document.execCommand("Copy");
            });

            //视频预览
            $("#pre-view-dialog-id").dialog({
                autoOpen : false,
                width : $(window).width()-20,
                modal : true,
                resizable : false,
                title: /*[[#{common.share.tip}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            $(this).dialog("close");
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            // $("#pre-view-id").pause();
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });
            //音频预览
            $("#pre-music-dialog-id").dialog({
                autoOpen : false,
                width : $(window).width()-20,
                modal : true,
                resizable : false,
                title: /*[[#{common.share.tip}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            $(this).dialog("close");
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            // $("#pre-music-id").pause();
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });
            //图片预览
            $("#file-picture-dialog-id").dialog({
                autoOpen : false,
                width : $(window).width(),
                modal : true,
                resizable : false,
                title: /*[[#{file.share.dialog}]]*/'',
                buttons: [
                    {
                        text: /*[[#{common.confirm}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    },
                    {
                        text: /*[[#{common.cancel}]]*/'',
                        click: function() {
                            $( this ).dialog( "close" );
                        }
                    }
                ]
            });
            //文件预览
            $("#pre-docmenut-dialog").dialog({
                autoOpen : false,
                width : $(window).width()-20,
                height : $(window).height(),
                modal : true,
                resizable : false,
                title: /*[[#{file.pre.docment.dialog}]]*/'',
                buttons: [
                ]
            });
        });//ready



           //文件移动
        function fileMoveBatch() {
            var ids = $("#flexgrid-id").getFlexigridiAttrByIndex(0);
            if(ids.length === 0){
                message(/*[[#{common.select.one}]]*/);
                return;
            }
            $("#file-move-dialog-id").attr("fileUuid",ids);
            $.ajax({
                type: 'post',
                async: false,
                dataType : 'json',
                url: /*[[@{/file/queryFileZtreeAll}]]*/'',
                data: [],
                success: function (data) {
                    $.fn.zTree.init($("#file-move-ztree-id"), allocateSetting, data);
                    $("#file-move-dialog-id").dialog('open');
                },
                error: function(msg){
                    message(/*[[#{common.error}]]*/'');
                }
            });

        }

        function query() {
            //条件查询读取属性
            var fileName = $("#search-file-name").attr("select-value");
            var fileUuid = $("#dir-input-id").attr("fileUuid");
            $("#flexgrid-id").flexOptions({
                extParam:[
                    {name:"fileName", value:fileName},
                    {name:"fileUuid", value:fileUuid}
                ]
            }).flexReload();
        }
        var allocateSetting = {
            check: {

                enable: true
            },
            data: {
                simpleData: {
                    enable: true
                }
            }
        };

        //分享文件
        function shareFile(fileUuid,fileName) {
            $("#share-file-dialog-id").attr("fileUuid",fileUuid);
            $("#share-file-name-id").text(fileName);
            $("#share-file-dialog-id").dialog('open');
        }

        //删除文件
        function deleteFile(fileUuid,fileName) {
            $("#delete-file-name-id").val(fileName);
            $("#recycle-file-dialog-id").attr("fileUuid",fileUuid);
            $("#recycle-file-dialog-id").dialog('open');
        }
        var index = 0;
        //获取文件分享链接
        function getShareFileLink() {
            var fileUuid = $("#share-file-dialog-id").attr("fileUuid");
            var validityDate = $("#share-validity-id").val();
            $.ajax({
                type: 'post',
                async: false,
                dataType: 'json',
                url: /*[[@{getShareFileLink}]]*/'',
                data: [
                    {name:"fileUuid",value:fileUuid},
                    {name:"validityDate",value:validityDate}
                ],
                success: function (data) {
                    //message(data.code);
                    var getQRCodeShare = /*[[@{getQRCodeShare}]]*/'';
                    $("#share-link-id").val(data.code);
                    $("#share-qr-code-id").attr("src",getQRCodeShare+"?index=" + index++);

                },
                error: function (msg) {
                    message(/*[[#{common.error}]]*/'');
                }
            });
        }

        //预览文件
        function preFile(fileName,fileUuid) {
            // alert（"视频预览"）
            $("#pre-view-dialog-id").parent().find(".ui-dialog-titlebar-close").click(function () {
                $("#pre-video-id")[0].pause();
            });
            $("#pre-music-dialog-id").parent().find(".ui-dialog-titlebar-close").click(function () {
                $("#pre-music-id")[0].pause();
            });
            var regView = new RegExp("^.+mp4$");
            var regDocument = new RegExp("^.+((doc)|(docx))$");
            if (regView.test(fileName)){
                $("#pre-view-dialog-id").dialog('option',"title",fileName);
                getPreUrl(fileUuid,function (linkUrl) {
                    $("#pre-video-id").attr("src",linkUrl);
                    $("#pre-view-dialog-id").dialog('open');
                })
            }
            else  if (regDocument.test(fileName)){
                $("#pre-document-dialog").dialog('option',"title",fileName);
                getPreUrl(fileUuid,function (linkUrl) {
                    linkUrl ="https://view.xdocin.com/xdoc?_xdoc=" + linkUrl.replaceAll("&","%26")
                    $("#pre-docmenut-iframe-id").attr("src",linkUrl);
                    $("#pre-docmenut-dialog").dialog('open');
                })
            }
            var picture = new RegExp("^.+jpg$");
            if (picture.test(fileName)){
                $("#file-picture-dialog-id").dialog('open');
                $("#file-picture-dialog-id").dialog('option',"title",fileName);
                getPreUrl(fileUuid,function (linkUrl) {
                    $("#file-picture-id").attr("src",linkUrl);
                });
            }
            var music = new RegExp("^.+mp3$");
            if (music.test(fileName)){
                $("#pre-music-dialog-id").dialog('option',"title",fileName);
                getPreUrl(fileUuid,function (linkUrl) {
                    $("#pre-music-id").attr("src",linkUrl);
                    $("#pre-music-dialog-id").dialog('open')
                });
            }
        }
        function getPreUrl(fileUuid,reback) {
            if (!reback) {
                return;
            }
            $.ajax({
                type: 'post',
                async:false,
                dataType:'json',
                url:/*[[@{getPreUrl}]]*/'',
                data:[
                    {name:"fileUuid",value:fileUuid}
                ],
                success:function (data) {
                    reback(data.code);
                },
                error:function (msg) {
                    message(/*[[#{common.error}]]*/'');
                }
            });
        }
        //进入文件夹
        function enterDir(filePath,fileUuid) {
            // console.info("filePath:" + filePath + "fileUuid:" + fileUuid );
            $("#dir-input-id").val(filePath);
            $("#dir-input-id").attr("fileUuid",fileUuid);
            query();
        }
        //分享文件
        function shareFile(fileUuid,fileName) {
            $("#share-file-dialog-id").attr("fileUuid",fileUuid);
            $("#share-file-name-id").text(fileName);
            getShareFileLink();
            $("#share-file-dialog-id").dialog('open');
        }
        var index = 0;
        //获取文件链接
        function getShareFileLink() {
            var fileUuid = $("#share-file-dialog-id").attr("fileUuid");
            var validityDate = $("#share-validity-id").val();
            $.ajax({
                type:'post',
                async:false,
                dataType:'json',
                url: /*[[@{getShareFileLink}]]*/'',
                data:[
                    {name:"fileUuid",value:fileUuid},
                    {name: "validityDate",value: validityDate}
                ],
                success:function (data) {
                    $("#share-link-id").val(data.code);
                    var getQRCodeShare = /*[[@{getQRCodeShare}]]*/'';
                    $("#share-qr-code-id").attr("src",getQRCodeShare+"?index=" + index++);
                },
                error: function (msg){
                    message(/*[[#{common.error}]]*/'');
                }
            });
        }

        //双击事件
        function rowDbclick(r){
            $(r).dblclick(
                function() {
                    var columnsArray = $(r).attr('ch').split("_FG$SP_");
                    console.info(columnsArray);
                    $("#mo-file-name-id").val(columnsArray[4]);
                    $("#modify-file-name-id").attr("fileUuid",columnsArray[0]);
                    $("#modify-file-name-id").dialog('open');
                });
        }


    </script>
<!-- 搜索框属性-->
    <style>
        .forder{
            color: #00B83F !important;
        }
        .forder > i{
            padding-right: 5px;
        }
        .nav-bar{
            display: flex;
            flex-direction: row;
            border-right: 1px solid #8c8c8c;
            padding: 0 5px;
        }
    </style>

    <style>

        .form-tr{
            display: flex;
            flex-direction: row;
            width: 100% !important;
        }
        .form-tr > .left{
            flex-basis: 100px;
            width: unset !important;
        }
        .form-tr > .right{
            flex-grow: 1;
            width: unset !important;
            display: inline-block !important;
        }
    </style>
    <style>
        .img{
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
    </style>


</head>
<body style="display: flex;flex-direction: column;">
<nav style="flex-basis: 31px;display: flex;flex-direction: row;margin:5px 0">
<!--    <nav >-->
<!--        <a  id="forward-btn-id" class="btn" th:title="#{file.forward}">&lt;!&ndash;    前进到下一级&ndash;&gt;-->
<!--            <i class="glyphicon glyphicon-arrow-right"></i>-->
<!--        </a>-->
<!--        <a  id="return-btn-id" class="btn" th:title="#{file.return}">&lt;!&ndash;    返回上一级&ndash;&gt;-->
<!--            <i class="glyphicon glyphicon-arrow-up"></i>-->
<!--        </a>-->
<!--    </nav>-->
    <!--   <input id="di r-id">-->
    <section class="nav-bar" style="flex-basis: 200px">
    <article id="nav-tools-article-id" class="nav-tools-article"></article>
        <a id="query-btn-id" class="btn" th:title="#{common.query}">
            <i class="glyphicon glyphicon-search"></i>
        </a>
    </section>
    <section class="nav-bar" style="flex-basis: 200px">
        <a id="up-dir-btn-id" class="btn" th:title="#{file.up.dir.btn}">
            <i class="glyphicon glyphicon-triangle-top"></i>
        </a>
        <input id="dir-input-id" class="form-control" style="width: 200px; display: inline-block" readonly value="/" fileUuid="-1">
    </section>
    <section class="nav-bar" style="flex-grow: 1;">
        <a sec:authorize="hasRole('ROLE_cldk_file_synch')" id="synch-btn-id" class="btn" th:title="#{file.synch}">
            <i class="glyphicon glyphicon-refresh"></i>
        </a>
        <!--        文件复制按钮设置-->
        <a sec:authorize="hasRole('ROLE_cldk_file_copy')" id="copy-btn-id" class="btn" th:title="#{file.copy}">
            <i class="glyphicon glyphicon-duplicate"></i>
        </a>

        <!--文件上传-->
        <a id="upload-file-btn-id" class="btn" th:title="#{file.upload}">
            <i class="glyphicon glyphicon-cloud-upload"></i>
        </a>
        <!--文件移动-->
        <a id="file-move-btn-id" class="btn" th:title="#{file.move}">
            <i class="glyphicon glyphicon-move"></i>
        </a>


    </section>




</nav>

<table id="flexgrid-id" style="flex-grow: 1"></table>
<div id="allow-menu-dialog-id" style="display: none">
    <ul id="allow-menu-ztree-id" class="ztree"></ul>
</div>
<!--文件分享-->
<div id="share-file-dialog-id" style="display: none">
    <div class="form-tr form-group">
        <span class="left" th:text="#{file.name}"></span>
        <span class="right" id="share-file-name-id"></span>
    </div>
    <div class="form-tr form-group">
        <span class="left" th:text="#{file.validity.date}"></span>
        <input id="share-validity-id" type="number" class="form-control left" value="1" min="1" onchange="getShareFileLink();">
    </div>


    <div class="form-tr form-group">
        <span class="left" th:text="#{file.share.link}"></span>
        <textarea class="form-control right" id="share-link-id" rows="5"></textarea>
    </div>
    <div class="form-tr form-group">
        <span class="left" th:text="#{file.share.link}"></span>
        <span class="right btn" id="copy-link-btn-id" th:text="#{file.copy.link}"></span>
    </div>
    <div class="form-tr form-group">
        <span class="left" th:text="#{file.qr.code.link}"></span>
        <img id="share-qr-code-id" class="right" th:src="@{getQRCodeShare}">
    </div>
</div>

<!--修改文件-->

<div class="form-group" id="modify-file-name-id" style="display: none">
    <div class="form-group">
    <span th:text="#{file.name}"></span>
    <input id="mo-file-name-id" class="form-control" name="fileName">
</div>


</div>
<!--上传文件-->
<div id="file-upload-dialog" style="display: none">
    <form id="file-upload-form-id" method="post" th:action="uploadFile" enctype="multipart/form-data">
        <input id="up-file-path-id" name="filePath" type="hidden">
        <input id="file-upload-file-id" type="file" name="fileName" th:placeholder="#{file.upload.placeholder}" pattern="^.+$">
    </form>

</div>

<!--移动文件-->
<div id="file-move-dialog-id" style="display: none">
    <ul id="file-move-ztree-id" class="ztree"></ul>
</div>

<!--删除文件-->
<div id="recycle-file-dialog-id" style="display: none">
    <div class="form-group">
        <span th:text="#{file.name}"></span>
        <input id="delete-file-name-id" class="form-control" name="fileName">
    </div>
</div>

<!--视频预览-->
<div id="pre-view-dialog-id"style="display: none">
    <video id="pre-video-id" width="500"  height="400"  controls="controls">

    </video>
</div>
<!--音频预览-->
<div id="pre-music-dialog-id"style="display: none">
    <video id="pre-music-id" width="500"  height="400"  controls="controls">

    </video>
</div>
<!--图片预览-->
<div id="file-picture-dialog-id" style="display: none">
    <img class="img" src="https://java-group2.obs.cn-north-4.myhuaweicloud.com:443/OIP.jpg?AccessKeyId=MUJTRUF9BIQVBOYWWJSN&Expires=1691130447&Signature=VdxNq4qJv1Kafvw0z63plPFGbqM%3D">
</div>
<!--文件复制-->
<div id="copy-file-dialog-id" style="display: none">
    <ul id="copy-file-ztree-id" class="ztree"></ul>
</div>
<!--预览文件-->
<div id="pre-docmenut-dialog" style="display: none">
    <iframe id="pre-docmenut-iframe-id" style=" width:100%; height:100%; border: none" >
    </iframe>
</div>
</body>
</html>